﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace System.Web.Mvc
{
    public class NameValue
    {
        public NameValue(int id,string name,string value)
        {
            Id = id; Name = name;Value = value;
        }
        public int Id { get; set; }
        public string Name { get; set; }
        public string Value { get; set; }
    }
    public class NameValueList
    {
        public static IList<NameValue> Add(params string[] str)
        {
            IList<NameValue> list = new List<NameValue>();
            for (int i = 0; i < str.Length; i++)
            {
                if (i % 2 == 0)
                {
                    list.Add(new NameValue(i/2,str[i], "#"));
                }else
                {
                    list.First(m => m.Id == i / 2).Value = str[i];
                }
            }
            return list;
        }
    }
}
